package com.itHsuSE.demo1;

import java.util.Scanner;

public class MulForExercise {
    public static void main(String[] args) {
        int totalLevel=10;
        for (int i = 1; i <= totalLevel; i++) {
            for (int k = 1; k <= totalLevel-i ; k++) {
                System.out.print(" ");
            }
            for (int j = 1; j <= 2*i-1 ; j++) {
                if(i!=totalLevel){
                    if(j==1||j==2*i-1){
                        System.out.print("*");
                    }else {
                        System.out.print(" ");
                    }
                }else {
                    System.out.print("*");
                }
            }
            System.out.println();
        }
    }

    public static void main2(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {

                System.out.print(j + "*" + i + "=" + (i * j) + "\t");

            }
            System.out.println();
        }
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int allAvgScore = 0;
        for (int i = 0; i < 3; i++) {
            int avgAcore = 0;
            for (int j = 0; j < 3; j++) {
                System.out.println("请输入班级" + (i + 1) + "的同学" + (j + 1) + "的成绩：");
                int score = sc.nextInt();
                avgAcore += score;
                System.out.println("班级" + (i + 1) + "的同学" + (j + 1) + "的成绩是：" + score);
            }
            System.out.println("班级" + (i + 1) + "的平均分是：" + (avgAcore / 3.0));
            allAvgScore += avgAcore;
        }
        System.out.println("全部班级的平均分是：" + (allAvgScore / 3.0 / 3.0));
    }
}
